<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
  import="java.util.ArrayList, db.*"   pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>
<!-- Icons for Web App
<link rel="apple-touch-icon" sizes="114x114" href="images/nav/index@2x.png">
<link rel="apple-touch-startup-image" href="images/splash/splash-screen.png" media="screen and (max-device-width: 320px)" />
<link rel="apple-touch-startup-image" media="(max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)" href="images/splash/splash-screen@2x.png" />
-->
<title>Frontera Pesos Server</title>
<link href="styles/style.css" rel="stylesheet" type="text/css">
<link href="styles/type.css" rel="stylesheet" type="text/css">
<link href="styles/buttons.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" media="only screen and (-webkit-min-device-pixel-ratio: 2)"      type="text/css" href="styles/highdpi.css" />

<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/highdpi.js"></script>
<script type="text/javascript" src="scripts/custom.js"></script>
<!-- utility js -->
<script type="text/javascript" src="../scripts/fronteraWebUtility.js"></script>
<script type="text/javascript">
function closeOutCust(ckInId,storeID,cusID)
{
	//alert(ckInId);
	document.getElementById("checkInID").value = ckInId;
	document.getElementById("storeID").value = storeID;
	document.getElementById("customerID").value = cusID;
	document.getElementById("checkInIDPage").submit();
	
	}
function homePage()
{
	var UrlLink = "userHomePage.jsp";
	window.location.href=UrlLink;

}
</script>
</head>

<body>
<% DBHelper helper = new DBHelper();
   
	String _errorMessage = "";
	String _userName = "";
	String _loginID = "";
	int admin = 1;
	int server = 1;
	
	String showAdminBtn = "none";
	String showServerBtn = "none";
	Cookie[] cookies = request.getCookies();
	ArrayList<UserData> userInfo =  new ArrayList<UserData>();
	ArrayList<Coupons> couponInfo =  new ArrayList<Coupons>();
	ArrayList<StoreLocation> storeInfo =  new ArrayList<StoreLocation>();
	ArrayList<UserCheckInData> checkedInCusInfo = new ArrayList<UserCheckInData>();
	int storeCkInId = 1;
	int _serverId = 11;
	
	if(session.getAttribute("storeCkInId") != null)
	{
		   
		    Object g =  session.getAttribute("storeCkInId");
		    storeCkInId = Integer.parseInt(g.toString());
		     System.out.println(" storeCkInId ==  " + storeCkInId);
	}

	/*if(session.getAttribute("_serverId") != null)
	{
		   
		    Object g =  session.getAttribute("_serverId");
		    _serverId = Integer.parseInt(g.toString());
		    if(admin == 1)
			{
		    	 showAdminBtn = "inline";
			}
		   
		   
		    System.out.println("_serverId made it here " + _serverId);
	}
	 */
	
	 if(session.getAttribute("adminRights") != null)
		{
			   
			    Object g =  session.getAttribute("adminRights");
			    admin = Integer.parseInt(g.toString());
			    if(admin == 1)
				{
			    	 showAdminBtn = "inline";
				}
			   
			   
			    System.out.println(" showAdminBtn ==  " + admin);
		}
		if(session.getAttribute("serverRights") != null)
		{
			   
			    Object g =  session.getAttribute("serverRights");
			    server = Integer.parseInt(g.toString());
			    if(server == 1)
				{
			    	showServerBtn = "inline";
				}
			    
			    System.out.println(" showServerBtn ==  " + server);
		}	 
	System.out.println("storeCkInId " + storeCkInId);
	System.out.println("_serverId " + _serverId);	
	
	checkedInCusInfo = helper.getCheckedInUsersinfo(storeCkInId);
	storeInfo=helper.getStoreInfo(); 
     
	%>	
<div class="landing-page">
        <p class="center-text landing-logo shadow">
        <img class="replace-2x" width="200" src="../assets/frontera-pesos-logo.png" alt="img">
        </p>
    
    <center>
     	<p>
     	<span style="display:<%=showAdminBtn%>">
        <a href="admin-view.jsp">Administration</a> - <a href="admin-view-customer.jsp">Customer Info</a> - 
        <a href="#" style="display:<%=showServerBtn%>" >Server</a> -
       </span>
        <span>
         <a href="admin-view-faq.html">Faq</a> - <a href="userHomePage.jsp">Home</a>
         </span>
          </p>
       
        <span>
        <p><a  href="javascript:void(0);" onClick="logUserOut();"><strong>Logout</strong></a><strong></strong></p>
        </span>
 
	
    <form name="checkInIDPage" id="checkInIDPage" action="../_main/serverCheckOutUserDetail.jsp" method="post" >
   		<input type="hidden" name="checkInID" id="checkInID"/>
   		<input type="hidden" name="storeID" id="storeID"/>
   		<input type="hidden" name="customerID" id="customerID"/>
   		<input type="hidden" name="serverID" id="serverID" value="<%=_serverId%>"/>
 	</form> 
     <form name="form1" method="post" action="">
        <p>
        </p>
          <select style="display:none" name="location" id="location">
          <option>Select Location</option>
           <% for(int i = 0; i < storeInfo.size(); i++) { 
     				System.out.println(" userdata  "+ i);%>
            
            <option <%if(storeCkInId == storeInfo.get(i).getStoreTableID()){ %> selected <%} %> value="<%=storeInfo.get(i).getStoreCity()%>"><%=storeInfo.get(i).getStoreName()%></option>
           <%} %>
        </select>
       </form>
       <br />
       <br />
     
       <br/>
        <% for(int i = 0; i < checkedInCusInfo.size(); i++) { 
     				System.out.println(" checkinfo  "+ i);%>
       
        <a href="javascript:void(0)" onclick="closeOutCust(<%=checkedInCusInfo.get(i).getCheckInTableId() %>,<%=checkedInCusInfo.get(i).getStoreLocationId() %>,<%=checkedInCusInfo.get(i).getCustTableId() %>)">
	        <div class="tablet-box">
			      <div class="tablet-customer">
			        <h3><%=checkedInCusInfo.get(i).getCustFullName() %><br/>
			       <%=FormatAndValidation.formatPhoneNumber(checkedInCusInfo.get(i).getPhoneNumber())%></h3>
			      </div>
	    	</div>
    	</a>
    	<%} %>
   
    </center>
    

<!--    <p class="login-note shadow"><strong>*</strong>Forgot my Password</p> -->
<div style="height:25px;"></div>
</div>
<style>
#registration-block{
        display:none;
}
</style>

    </div>
<script>
    $('#register-button').click(function() {
      $('#registration-block').fadeIn('slow', function() {
        // Animation complete
      });
    });
</script>

</body>

</html>